//引入view组件
const Login = () => import('@/views/admin/Login')
const Home = () => import('@/views/admin/Home')
const Dashboard = () => import('@/views/admin/Dashboard')
const NotFound = () => import('@/views/404')
const User = () => import('@/views/admin/general/User')
const Announcement = () => import('@/views/admin/general/Announcement')
const SysNotice = () => import('@/views/admin/general/SysNotice')
const SystemConfig = () => import('@/views/admin/general/SystemConfig')
const SysSwitch = () => import('@/views/admin/general/SysSwitch')
const Discussion = () => import('@/views/admin/discussion/Discussion')
const Tag = () => import('@/views/admin/problem/Tag')
const Problem = () => import('@/views/admin/problem/Problem')
const ProblemList = () => import('@/views/admin/problem/ProblemList')
const ProblemImportAndExport = () => import('@/views/admin/problem/ImportAndExport')

const adminRoutes = [
    {
        path: '/admin/login',
        name: 'admin-login',
        component: Login,
        meta: {title: 'Login'}
    },
    {
        path: '/admin/',
        component: Home,
        //启用验证
        meta: {requireAuth: true, requireAdmin: true},
        children: [
            {
                path: '',
                redirect: 'dashboard',
                component: Dashboard,
                meta: {title: 'Dashboard'}
            },
            {
                path: 'dashboard',
                name: 'admin-dashboard',
                component: Dashboard,
                meta: {title: 'Dashboard'}
            },
            {
                path: 'user',
                name: 'admin-user',
                component: User,
                meta: {requireSuperAdmin: true, title: 'User Admin'},
            },
            {
                path: 'announcement',
                name: 'admin-announcement',
                component: Announcement,
                meta: {requireSuperAdmin: true, title: 'Announcement Admin'},
            },
            {
                path: 'notice',
                name: 'admin-notice',
                component: SysNotice,
                meta: {requireSuperAdmin: true, title: 'Notice Admin'},
            },
            {
                path: 'conf',
                name: 'admin-conf',
                component: SystemConfig,
                meta: {requireSuperAdmin: true, title: 'System Config'},
            },
            {
                path: 'switch',
                name: 'admin-switch',
                component: SysSwitch,
                meta: {requireSuperAdmin: true, title: 'System Switch'},
            },
            {
                path: 'discussion',
                name: 'admin-discussion-list',
                component: Discussion,
                meta: {title: 'Discussion Admin'}
            },
            {
                path: 'problem/tag',
                name: 'admin-problem-tag',
                component: Tag,
                meta: {title: 'Admin Tag'},
            },
            {
                path: 'problem/create',
                name: 'admin-create-problem',
                component: Problem,
                meta: {title: 'Create Problem'},
            },
            {
                path: 'problem/edit/:problemId',
                name: 'admin-edit-problem',
                component: Problem,
                meta: {title: 'Edit Problem'},
            },
            {
                path: 'problems',
                name: 'admin-problem-list',
                component: ProblemList,
                meta: {title: 'Problem List'},
            },
            {
                path: 'problem/batch-operation',
                name: 'admin-problem_batch_operation',
                component: ProblemImportAndExport,
                meta: {title: 'Export Import Problem'},
            },
        ]
    },
    {
        path: '/admin/*',
        meta: {title: '404'},
        component: NotFound
    }
]
export default adminRoutes